<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>点击按钮添加一行 tr</title>
</head>

<body>
  <table id="sampleTable" border="1">
    <tr>
      <td>Row1 cell1</td>
      <td>Row1 cell2</td>
    </tr>
  </table>
  <button onclick="aa()">添加</button>
</body>
<script>
  function aa() {
    var table = document.getElementById("sampleTable");
    var row = table.insertRow(0);  //创建空的 <tr> 元素 并将其添加到表中。
    var cell1 = row.insertCell(0);  //单元格插入到当前行中
    cell1.innerHTML = "1";
  }
</script>

</html>